#region Using

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;

using Gizmox.WebGUI.Common;
using Gizmox.WebGUI.Forms;
using WaveMaster.Holidays.Club.Service;
using System.Configuration;
using WaveMaster.Holidays.Club.Domain;

#endregion

namespace WaveMaster.Holidays.Club.Web
{
    public partial class PrintManifestForm : Form
    {
        CheckInService m_BookingService;

        public PrintManifestForm(Trip trip, bool IDN, User m_currentUser)
        {
            InitializeComponent();
            this.Text = "Print Manifest - Boarding Passenger";

            m_BookingService = new CheckInService();// (CheckInService)ServiceFactory.Instance().GetService(ServiceFactory.BOOKING_SERVICE);
            DataSet result = m_BookingService.ReportManifestByTripID(trip, m_currentUser, PassengerStatus.Boarding);
            htmlBox1.Html = "Load Report...";
            result.WriteXml(ConfigurationManager.AppSettings["ReportDataTemp"] + "ReportManifestData" + m_currentUser.UserID + ".xml", XmlWriteMode.WriteSchema);
            if (IDN)
                htmlBox1.Url = ConfigurationManager.AppSettings["URLReport"] + "ReportViewer.aspx?ReportDataSource=ReportManifestData" + m_currentUser.UserID + ".xml&ReportFile=ReportManifestByTripID.rpt";
            else
                htmlBox1.Url = ConfigurationManager.AppSettings["URLReport"] + "ReportViewer.aspx?ReportDataSource=ReportManifestData" + m_currentUser.UserID + ".xml&ReportFile=ReportManifestByTripSG.rpt";
            htmlBox1.Update();
            htmlBox1.Update();

           // result.WriteXml(@"D:\Others\Projects\WaveMasterBoardingManagementSystem\ReportManifestByTripID.xml", XmlWriteMode.WriteSchema);
            //string reportID = ServiceFactory.GenerateRandomID().ToString();
            //Session["ReportManifestByTripIDData" + reportID] = result;
            //if(ID)
            //    Session["ReportManifestByTripIDFile" + reportID] = "ReportManifestByTripID.rpt";
            //else
            //    Session["ReportManifestByTripIDFile" + reportID] = "ReportManifestByTripSG.rpt";
            //string param1 = "ReportDataSource=ReportManifestByTripIDData" + reportID;
            //string param2 = "ReportFile=ReportManifestByTripIDFile" + reportID;
            //htmlBox1.Url = ConfigurationManager.AppSettings["URLReport"] + "ReportViewer.aspx?" + param1 + "&" + param2;
            ////htmlBox1.Url = "http://" + this.Context.HttpContext.Request.ServerVariables["SERVER_NAME"] + ":" + this.Context.HttpContext.Request.ServerVariables["SERVER_PORT"] + @"/Report/" + "ReportViewer.aspx?" + param1 + "&" + param2;
            //htmlBox1.Update();
        }
    }
}